<template>
	<view class="content">
		<web-view :src="urls" class="webview" @message="getMessage" @onPostMessage="handlePostMessage"></web-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				urls: '',
				id: '',
			}
		},
		onLoad(e) {
			this.id = e.id;
			console.log(e);
			// this.urls = 'https://3d.28vu.com/?id=' + e.id + '&Authorization=' + uni.getStorageSync('accessToken');
			this.urls = 'https://test.huanti3d.com/?type=1&id=' + e.id + '&Authorization=' + uni.getStorageSync(
				'accessToken');
		},
		onShareAppMessage() {

		},
		methods: {
			handlePostMessage: function(data) {
				console.log("接收到消息：" + JSON.stringify(data.detail));
			},
			getMessage(e) {
				// console.log('是武器', e.detail[1].objurl)
				console.log('是武器', e.detail.data[0].objurl);
				if (e.detail.data[0].objurl) {
					uni.setStorageSync('objurl', e.detail.data[0].objurl)
				}
				if (e.detail.data[0].model_id) {
					uni.setStorageSync('model_id', e.detail.data[0].model_id)
				}

			},
		}
	}
</script>

<style lang="scss">
</style>